﻿using YNTK.Message.Entitys;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace YNTK.Message.Interfaces.Message
{
    /// <summary>
    /// 系统消息服务
    /// 版 本：V1.0.0
    /// 版 权：云南通科科技有限公司（https://www.yntkkj.com）
    /// 作 者：李仕鹏
    /// 日 期：2022-11-09
    /// </summary>
    public interface IMessageService
    {
        /// <summary>
        /// 列表
        /// </summary>
        /// <param name="type">类型(1:公告，2：im消息)</param>
        /// <returns></returns>
        Task<List<MessageEntity>> GetList(int type);

        /// <summary>
        /// 默认公告(app)
        /// </summary>
        /// <returns></returns>
        public string GetInfoDefaultNotice();

        /// <summary>
        /// 默认消息(app)
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public string GetInfoDefaultMessage(string userId);   

        /// <summary>
        /// 消息已读（单条）
        /// </summary>
        /// <param name="userId">当前用户</param>
        /// <param name="messageId">消息主键</param>
        Task MessageRead(string userId, string messageId);

        /// <summary>
        /// 消息已读（全部）
        /// </summary>
        /// <param name="userId">当前用户</param>
        Task MessageRead(string userId);

        /// <summary>
        /// 删除记录
        /// </summary>
        /// <param name="userId">当前用户</param>
        /// <param name="messageIds">消息Id</param>
        Task<int> DeleteRecord(string userId, List<string> messageIds);

        /// <summary>
        /// 获取公告未读数量
        /// </summary>
        /// <param name="userId">用户id</param>
        /// <returns></returns>
        int GetUnreadNoticeCount(string userId);

        /// <summary>
        /// 获取消息未读数量
        /// </summary>
        /// <param name="userId">用户id</param>
        /// <returns></returns>
        int GetUnreadMessageCount(string userId);

        /// <summary>
        /// 发送站内消息(系统消息)
        /// </summary>
        /// <param name="toUserIds">接收用户id集合</param>
        /// <param name="title">标题</param>
        /// <param name="bodyText">正文</param>
        /// <returns></returns>
        Task SentMessage(List<string> toUserIds, string title, string bodyText = null);
    }
}
